function [pval] = f_tstat2pval(tstat, df) 

tstat = tstat(:);

for i = 1:size(tstat, 1)
pval(1, i) = 2*((tcdf(-abs(tstat(i, 1)),df-1)));
end